from typing import List


class Solution:
    def moveZeroes(self, nums: List[int]) -> None:
        """
        双指针
        Do not return anything, modify nums in-place instead.
        """
        left, right = 0, 0
        while right < len(nums):
            if nums[right] != 0:
                nums[left], nums[right] = nums[right], nums[left]
                left += 1
            right += 1

    def moveZeroes2(self, nums: List[int]) -> None:
        '''
        双指针, 原理和上面一样
        '''
        index = 0
        for num in nums:
            if num != 0:
                nums[index] = num
                index += 1
        for i in range(index,len(nums)):
            nums[i] = 0
